package actions;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;

import client_gui.ClientWindow;

/**
 * Klasa predstavlja akciju resetovanja prozora na default velicinu i lokaciju u
 * centru ekrana.
 * 
 * @author UrosKrkic & Radivoje Popovic
 */
public class DefaultPositionAndSizeAction extends RLMAbstractAction {

	
	public DefaultPositionAndSizeAction(ClientWindow owner) {
		setActionOwner(owner);
//		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0));
		putValue(SMALL_ICON, loadIcon("images/pos_size.png"));
		putValue(NAME, "Default Position and Size");
		putValue(SHORT_DESCRIPTION, "Default Position and Size");
	}
	
	
	public void actionPerformed(ActionEvent e) {
		getActionOwner().setSize(CLIENT_WIDTH, CLIENT_HEIGHT);
		
		Toolkit kit = getActionOwner().getToolkit();
		Dimension dim = kit.getScreenSize();
		getActionOwner().setLocation( (dim.width-CLIENT_WIDTH)/2, (dim.height-CLIENT_HEIGHT)/2 );
		
		getActionOwner().pack();
	}
}
